﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;
using Teigha.Core;

namespace Teigha.TD
{
	public class OdDbSurface : OdDbEntity
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdDbSurface(IntPtr cPtr, bool cMemoryOwn) : base(TD_DbPINVOKE.OdDbSurface_SWIGUpcast(cPtr), cMemoryOwn)
		{
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdDbSurface obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdDbSurface()
		{
			this.Dispose();
		}

		public override void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							TD_DbPINVOKE.delete_OdDbSurface(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
			base.Dispose();
		}

		public new static OdDbSurface cast(OdRxObject pObj)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = TD_DbPINVOKE.OdDbSurface_cast(OdRxObject.getCPtr(pObj));
			OdDbSurface result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdDbSurface)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdDbSurface)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdDbSurface)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdRxClass desc()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(TD_DbPINVOKE.OdDbSurface_desc(), false);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxClass isA()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(TD_DbPINVOKE.OdDbSurface_isA(this.swigCPtr), false);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxObject queryX(OdRxClass protocolClass)
		{
			OdRxObject result = Teigha.Core.Helpers.odrxCreateObjectInternal(TD_DbPINVOKE.OdDbSurface_queryX(this.swigCPtr, OdRxClass.getCPtr(protocolClass)), false);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdDbSurface createObject()
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = TD_DbPINVOKE.OdDbSurface_createObject();
			OdDbSurface result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdDbSurface)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdDbSurface)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdDbSurface)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual ushort uIsolineDensity()
		{
			ushort result = TD_DbPINVOKE.OdDbSurface_uIsolineDensity(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void setUIsolineDensity(ushort numIsolines)
		{
			TD_DbPINVOKE.OdDbSurface_setUIsolineDensity(this.swigCPtr, numIsolines);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual ushort vIsolineDensity()
		{
			ushort result = TD_DbPINVOKE.OdDbSurface_vIsolineDensity(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void setVIsolineDensity(ushort numIsolines)
		{
			TD_DbPINVOKE.OdDbSurface_setVIsolineDensity(this.swigCPtr, numIsolines);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public static OdResult createFrom(OdDbEntity pFromEntity, out OdDbSurface pNewSurface)
		{
			IntPtr zero = IntPtr.Zero;
			OdResult result;
			try
			{
				OdResult odResult = (OdResult)TD_DbPINVOKE.OdDbSurface_createFrom(OdDbEntity.getCPtr(pFromEntity), out zero);
				if (TD_DbPINVOKE.SWIGPendingException.Pending)
				{
					throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
				}
				result = odResult;
			}
			finally
			{
				pNewSurface = (OdDbSurface)Teigha.Core.Helpers.odrxCreateObjectInternal(zero, true);
			}
			return result;
		}

		public virtual OdResult convertToRegion(OdDbEntityPtrArray regions)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbSurface_convertToRegion(this.swigCPtr, OdDbEntityPtrArray.getCPtr(regions));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdResult thicken(double thickness, bool bBothSides, out OdDb3dSolid pSolid)
		{
			IntPtr zero = IntPtr.Zero;
			OdResult result;
			try
			{
				OdResult odResult = (OdResult)TD_DbPINVOKE.OdDbSurface_thicken(this.swigCPtr, thickness, bBothSides, out zero);
				if (TD_DbPINVOKE.SWIGPendingException.Pending)
				{
					throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
				}
				result = odResult;
			}
			finally
			{
				pSolid = (OdDb3dSolid)Teigha.Core.Helpers.odrxCreateObjectInternal(zero, true);
			}
			return result;
		}

		public virtual OdResult getArea(out double area)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbSurface_getArea(this.swigCPtr, out area);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool isNull()
		{
			bool result = TD_DbPINVOKE.OdDbSurface_isNull(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdResult acisOut(OdStreamBuf pStreamBuf, int typeVer)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbSurface_acisOut__SWIG_0(this.swigCPtr, OdStreamBuf.getCPtr(pStreamBuf), typeVer);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdResult acisOut(OdStreamBuf pStreamBuf)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbSurface_acisOut__SWIG_1(this.swigCPtr, OdStreamBuf.getCPtr(pStreamBuf));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdResult acisIn(OdStreamBuf pStreamBuf, out int pTypeVer)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbSurface_acisIn__SWIG_0(this.swigCPtr, OdStreamBuf.getCPtr(pStreamBuf), out pTypeVer);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdResult acisIn(OdStreamBuf pStreamBuf)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbSurface_acisIn__SWIG_1(this.swigCPtr, OdStreamBuf.getCPtr(pStreamBuf));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void brep(OdBrBrep brep)
		{
			TD_DbPINVOKE.OdDbSurface_brep(this.swigCPtr, OdBrBrep.getCPtr(brep));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public new virtual OdDbObject decomposeForSave(DwgVersion ver, OdDbObjectId replaceId, out bool exchangeXData)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = TD_DbPINVOKE.OdDbSurface_decomposeForSave(this.swigCPtr, (int)ver, OdDbObjectId.getCPtr(replaceId), out exchangeXData);
			OdDbObject result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdDbObject)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdDbObject)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdDbObject)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdResult subExplode(OdRxObjectPtrArray entitySet)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbSurface_subExplode(this.swigCPtr, OdRxObjectPtrArray.getCPtr(entitySet));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdResult subTransformBy(OdGeMatrix3d xfm)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbSurface_subTransformBy(this.swigCPtr, OdGeMatrix3d.getCPtr(xfm));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdResult setBody(IntPtr pGeometry)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbSurface_setBody(this.swigCPtr, pGeometry);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual IntPtr body()
		{
			IntPtr result = TD_DbPINVOKE.OdDbSurface_body(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdResult dwgInFields(OdDbDwgFiler pFiler)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbSurface_dwgInFields(this.swigCPtr, OdDbDwgFiler.getCPtr(pFiler));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual void dwgOutFields(OdDbDwgFiler pFiler)
		{
			TD_DbPINVOKE.OdDbSurface_dwgOutFields(this.swigCPtr, OdDbDwgFiler.getCPtr(pFiler));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public new virtual OdResult dxfInFields(OdDbDxfFiler pFiler)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbSurface_dxfInFields(this.swigCPtr, OdDbDxfFiler.getCPtr(pFiler));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual void dxfOutFields(OdDbDxfFiler pFiler)
		{
			TD_DbPINVOKE.OdDbSurface_dxfOutFields(this.swigCPtr, OdDbDxfFiler.getCPtr(pFiler));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public new virtual bool subWorldDraw(OdGiWorldDraw pWd)
		{
			bool result = TD_DbPINVOKE.OdDbSurface_subWorldDraw(this.swigCPtr, OdGiWorldDraw.getCPtr(pWd));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdResult subGetClassID(IntPtr pClsid)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbSurface_subGetClassID(this.swigCPtr, pClsid);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdDbSubentId internalSubentId(IntPtr ent)
		{
			OdDbSubentId result = new OdDbSubentId(TD_DbPINVOKE.OdDbSurface_internalSubentId(this.swigCPtr, ent), true);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual IntPtr internalSubentPtr(OdDbSubentId id)
		{
			IntPtr result = TD_DbPINVOKE.OdDbSurface_internalSubentPtr(this.swigCPtr, OdDbSubentId.getCPtr(id));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdResult createInterferenceObjects(OdDbEntityPtrArray interferenceObjects, OdDbEntity pEntity, uint flags)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbSurface_createInterferenceObjects(this.swigCPtr, OdDbEntityPtrArray.getCPtr(interferenceObjects), OdDbEntity.getCPtr(pEntity), flags);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdResult booleanUnion(OdDbSurface pSurface, out OdDbSurface pNewSurface)
		{
			IntPtr zero = IntPtr.Zero;
			OdResult result;
			try
			{
				OdResult odResult = (OdResult)TD_DbPINVOKE.OdDbSurface_booleanUnion(this.swigCPtr, OdDbSurface.getCPtr(pSurface), out zero);
				if (TD_DbPINVOKE.SWIGPendingException.Pending)
				{
					throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
				}
				result = odResult;
			}
			finally
			{
				pNewSurface = (OdDbSurface)Teigha.Core.Helpers.odrxCreateObjectInternal(zero, true);
			}
			return result;
		}

		public virtual OdResult booleanSubtract(OdDbSurface pSurface, out OdDbSurface pNewSurface)
		{
			IntPtr zero = IntPtr.Zero;
			OdResult result;
			try
			{
				OdResult odResult = (OdResult)TD_DbPINVOKE.OdDbSurface_booleanSubtract__SWIG_0(this.swigCPtr, OdDbSurface.getCPtr(pSurface), out zero);
				if (TD_DbPINVOKE.SWIGPendingException.Pending)
				{
					throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
				}
				result = odResult;
			}
			finally
			{
				pNewSurface = (OdDbSurface)Teigha.Core.Helpers.odrxCreateObjectInternal(zero, true);
			}
			return result;
		}

		public virtual OdResult booleanSubtract(OdDb3dSolid pSolid, out OdDbSurface pNewSurface)
		{
			IntPtr zero = IntPtr.Zero;
			OdResult result;
			try
			{
				OdResult odResult = (OdResult)TD_DbPINVOKE.OdDbSurface_booleanSubtract__SWIG_1(this.swigCPtr, OdDb3dSolid.getCPtr(pSolid), out zero);
				if (TD_DbPINVOKE.SWIGPendingException.Pending)
				{
					throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
				}
				result = odResult;
			}
			finally
			{
				pNewSurface = (OdDbSurface)Teigha.Core.Helpers.odrxCreateObjectInternal(zero, true);
			}
			return result;
		}

		public virtual OdResult booleanIntersect(OdDbSurface pSurface2, OdDbEntityPtrArray intersectionEntities)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbSurface_booleanIntersect__SWIG_0(this.swigCPtr, OdDbSurface.getCPtr(pSurface2), OdDbEntityPtrArray.getCPtr(intersectionEntities));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdResult booleanIntersect(OdDb3dSolid pSolid, OdDbEntityPtrArray intersectionEntities)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbSurface_booleanIntersect__SWIG_1(this.swigCPtr, OdDb3dSolid.getCPtr(pSolid), OdDbEntityPtrArray.getCPtr(intersectionEntities));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdResult imprintEntity(OdDbEntity pEntity)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbSurface_imprintEntity(this.swigCPtr, OdDbEntity.getCPtr(pEntity));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdResult createSectionObjects(OdGePlane sectionPlane, OdDbEntityPtrArray sectionObjects)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbSurface_createSectionObjects(this.swigCPtr, OdGePlane.getCPtr(sectionPlane), OdDbEntityPtrArray.getCPtr(sectionObjects));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdResult sliceByPlane(OdGePlane slicePlane, out OdDbSurface pNegHalfSurface, out OdDbSurface pNewSurface)
		{
			IntPtr zero = IntPtr.Zero;
			IntPtr zero2 = IntPtr.Zero;
			OdResult result;
			try
			{
				OdResult odResult = (OdResult)TD_DbPINVOKE.OdDbSurface_sliceByPlane(this.swigCPtr, OdGePlane.getCPtr(slicePlane), out zero, out zero2);
				if (TD_DbPINVOKE.SWIGPendingException.Pending)
				{
					throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
				}
				result = odResult;
			}
			finally
			{
				pNegHalfSurface = (OdDbSurface)Teigha.Core.Helpers.odrxCreateObjectInternal(zero, true);
				pNewSurface = (OdDbSurface)Teigha.Core.Helpers.odrxCreateObjectInternal(zero2, true);
			}
			return result;
		}

		public virtual OdResult sliceBySurface(OdDbSurface pSlicingSurface, out OdDbSurface pNegHalfSurface, out OdDbSurface pNewSurface)
		{
			IntPtr zero = IntPtr.Zero;
			IntPtr zero2 = IntPtr.Zero;
			OdResult result;
			try
			{
				OdResult odResult = (OdResult)TD_DbPINVOKE.OdDbSurface_sliceBySurface(this.swigCPtr, OdDbSurface.getCPtr(pSlicingSurface), out zero, out zero2);
				if (TD_DbPINVOKE.SWIGPendingException.Pending)
				{
					throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
				}
				result = odResult;
			}
			finally
			{
				pNegHalfSurface = (OdDbSurface)Teigha.Core.Helpers.odrxCreateObjectInternal(zero, true);
				pNewSurface = (OdDbSurface)Teigha.Core.Helpers.odrxCreateObjectInternal(zero2, true);
			}
			return result;
		}

		public virtual OdResult chamferEdges(OdDbSubentIdArray edgeSubentIds, OdDbSubentId baseFaceSubentId, double baseDist, double otherDist)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbSurface_chamferEdges(this.swigCPtr, OdDbSubentIdArray.getCPtr(edgeSubentIds), OdDbSubentId.getCPtr(baseFaceSubentId), baseDist, otherDist);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdResult filletEdges(OdDbSubentIdArray edgeSubentIds, OdGeDoubleArray radius, OdGeDoubleArray startSetback, OdGeDoubleArray endSetback)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbSurface_filletEdges(this.swigCPtr, OdDbSubentIdArray.getCPtr(edgeSubentIds), OdGeDoubleArray.getCPtr(radius), OdGeDoubleArray.getCPtr(startSetback), OdGeDoubleArray.getCPtr(endSetback));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdResult setSubentColor(OdDbSubentId subentId, OdCmColor color)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbSurface_setSubentColor(this.swigCPtr, OdDbSubentId.getCPtr(subentId), OdCmColor.getCPtr(color));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdResult getSubentColor(OdDbSubentId subentId, OdCmColor color)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbSurface_getSubentColor(this.swigCPtr, OdDbSubentId.getCPtr(subentId), OdCmColor.getCPtr(color));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdResult setSubentMaterial(OdDbSubentId subentId, OdDbObjectId matId)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbSurface_setSubentMaterial(this.swigCPtr, OdDbSubentId.getCPtr(subentId), OdDbObjectId.getCPtr(matId));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdResult getSubentMaterial(OdDbSubentId subentId, OdDbObjectId matId)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbSurface_getSubentMaterial(this.swigCPtr, OdDbSubentId.getCPtr(subentId), OdDbObjectId.getCPtr(matId));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdResult setSubentMaterialMapper(OdDbSubentId subentId, OdGiMapper mapper)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbSurface_setSubentMaterialMapper(this.swigCPtr, OdDbSubentId.getCPtr(subentId), OdGiMapper.getCPtr(mapper));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdResult getSubentMaterialMapper(OdDbSubentId subentId, OdGiMapper mapper)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbSurface_getSubentMaterialMapper(this.swigCPtr, OdDbSubentId.getCPtr(subentId), OdGiMapper.getCPtr(mapper));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdResult subGetGsMarkersAtSubentPath(OdDbFullSubentPath subPath, SWIGTYPE_p_OdGsMarkerArray gsMarkers)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbSurface_subGetGsMarkersAtSubentPath(this.swigCPtr, OdDbFullSubentPath.getCPtr(subPath), SWIGTYPE_p_OdGsMarkerArray.getCPtr(gsMarkers));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdResult subGetSubentPathsAtGsMarker(SubentType type, IntPtr gsMark, OdGePoint3d pickPoint, OdGeMatrix3d viewXform, OdDbFullSubentPathArray subentPaths, OdDbObjectIdArray pEntAndInsertStack)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbSurface_subGetSubentPathsAtGsMarker__SWIG_0(this.swigCPtr, (int)type, gsMark, OdGePoint3d.getCPtr(pickPoint), OdGeMatrix3d.getCPtr(viewXform), OdDbFullSubentPathArray.getCPtr(subentPaths), OdDbObjectIdArray.getCPtr(pEntAndInsertStack));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdResult subGetSubentPathsAtGsMarker(SubentType type, IntPtr gsMark, OdGePoint3d pickPoint, OdGeMatrix3d viewXform, OdDbFullSubentPathArray subentPaths)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbSurface_subGetSubentPathsAtGsMarker__SWIG_1(this.swigCPtr, (int)type, gsMark, OdGePoint3d.getCPtr(pickPoint), OdGeMatrix3d.getCPtr(viewXform), OdDbFullSubentPathArray.getCPtr(subentPaths));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdResult subGetTransformedCopy(OdGeMatrix3d mat, out OdDbEntity pCopy)
		{
			IntPtr zero = IntPtr.Zero;
			OdResult result;
			try
			{
				OdResult odResult = (OdResult)TD_DbPINVOKE.OdDbSurface_subGetTransformedCopy(this.swigCPtr, OdGeMatrix3d.getCPtr(mat), out zero);
				if (TD_DbPINVOKE.SWIGPendingException.Pending)
				{
					throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
				}
				result = odResult;
			}
			finally
			{
				pCopy = (OdDbEntity)Teigha.Core.Helpers.odrxCreateObjectInternal(zero, true);
			}
			return result;
		}

		public virtual OdResult convertToNurbSurface(OdDbNurbSurfaceArray nurbSurfaceArray)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbSurface_convertToNurbSurface(this.swigCPtr, OdDbNurbSurfaceArray.getCPtr(nurbSurfaceArray));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual uint subSetAttributes(OdGiDrawableTraits pTraits)
		{
			uint result = TD_DbPINVOKE.OdDbSurface_subSetAttributes(this.swigCPtr, OdGiDrawableTraits.getCPtr(pTraits));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static OdResult trimSurface(OdDbObjectId blankSurfaceId, OdDbObjectIdArray toolIds, OdDbObjectIdArray toolCurveIds, OdGeVector3dArray projVectors, OdGePoint3d pickPoint, OdGeVector3d viewVector, bool bAutoExtend, bool bAssociativeEnabled)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbSurface_trimSurface(OdDbObjectId.getCPtr(blankSurfaceId), OdDbObjectIdArray.getCPtr(toolIds), OdDbObjectIdArray.getCPtr(toolCurveIds), OdGeVector3dArray.getCPtr(projVectors), OdGePoint3d.getCPtr(pickPoint), OdGeVector3d.getCPtr(viewVector), bAutoExtend, bAssociativeEnabled);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdResult projectOnToSurface(OdDbEntity pEntityToProject, OdGeVector3d projectionDirection, OdDbEntityPtrArray projectedEntities)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbSurface_projectOnToSurface(this.swigCPtr, OdDbEntity.getCPtr(pEntityToProject), OdGeVector3d.getCPtr(projectionDirection), OdDbEntityPtrArray.getCPtr(projectedEntities));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdResult getPerimeter(out double arg0)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbSurface_getPerimeter(this.swigCPtr, out arg0);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdResult rayTest(OdGePoint3d rayBasePoint, OdGeVector3d rayDir, double rayRadius, OdDbSubentIdArraySt subEntIds, OdGeDoubleArray parameters)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbSurface_rayTest(this.swigCPtr, OdGePoint3d.getCPtr(rayBasePoint), OdGeVector3d.getCPtr(rayDir), rayRadius, OdDbSubentIdArraySt.getCPtr(subEntIds), OdGeDoubleArray.getCPtr(parameters));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static OdResult createOffsetSurface(OdDbEntity pInputSurface, double dOffsetDistance, out OdDbEntity offsetSurface)
		{
			IntPtr zero = IntPtr.Zero;
			OdResult result;
			try
			{
				OdResult odResult = (OdResult)TD_DbPINVOKE.OdDbSurface_createOffsetSurface__SWIG_0(OdDbEntity.getCPtr(pInputSurface), dOffsetDistance, out zero);
				if (TD_DbPINVOKE.SWIGPendingException.Pending)
				{
					throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
				}
				result = odResult;
			}
			finally
			{
				offsetSurface = (OdDbEntity)Teigha.Core.Helpers.odrxCreateObjectInternal(zero, true);
			}
			return result;
		}

		public static OdResult createOffsetSurface(OdDbEntity pInputSurface, double dOffsetDistance, bool bAssociativeEnabled, OdDbObjectId offsetSurfaceId)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbSurface_createOffsetSurface__SWIG_1(OdDbEntity.getCPtr(pInputSurface), dOffsetDistance, bAssociativeEnabled, OdDbObjectId.getCPtr(offsetSurfaceId));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static OdResult createFilletSurface(OdDbObjectId surfId1, OdGePoint3d pickPt1, OdDbObjectId surfId2, OdGePoint3d pickPt2, double dRadius, FilletTrimMode trimMode, OdGeVector3d projDir, SWIGTYPE_p_p_OdDbSurface filletSurface)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbSurface_createFilletSurface__SWIG_0(OdDbObjectId.getCPtr(surfId1), OdGePoint3d.getCPtr(pickPt1), OdDbObjectId.getCPtr(surfId2), OdGePoint3d.getCPtr(pickPt2), dRadius, (int)trimMode, OdGeVector3d.getCPtr(projDir), SWIGTYPE_p_p_OdDbSurface.getCPtr(filletSurface));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static OdResult createFilletSurface(OdDbObjectId surfId1, OdGePoint3d pickPt1, OdDbObjectId surfId2, OdGePoint3d pickPt2, double dRadius, FilletTrimMode trimMode, OdGeVector3d projDir, bool bAssociativeEnabled, OdDbObjectId filletSurfaceId)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbSurface_createFilletSurface__SWIG_1(OdDbObjectId.getCPtr(surfId1), OdGePoint3d.getCPtr(pickPt1), OdDbObjectId.getCPtr(surfId2), OdGePoint3d.getCPtr(pickPt2), dRadius, (int)trimMode, OdGeVector3d.getCPtr(projDir), bAssociativeEnabled, OdDbObjectId.getCPtr(filletSurfaceId));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static OdResult createExtendSurface(OdDbObjectId sourceSurface, OdDbSubentIdArraySt edgesId, double dExtDist, EdgeExtensionType extOption, bool bAssociativeEnabled, OdDbObjectId newExtendSurfaceId)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbSurface_createExtendSurface(OdDbObjectId.getCPtr(sourceSurface), OdDbSubentIdArraySt.getCPtr(edgesId), dExtDist, (int)extOption, bAssociativeEnabled, OdDbObjectId.getCPtr(newExtendSurfaceId));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdResult extendEdges(OdDbFullSubentPathArray edgesId, double dExtDist, EdgeExtensionType extOption, bool bAssociativeEnabled)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbSurface_extendEdges(this.swigCPtr, OdDbFullSubentPathArray.getCPtr(edgesId), dExtDist, (int)extOption, bAssociativeEnabled);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		private object locker = new object();

		private HandleRef swigCPtr;
	}
}
